<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;

class Index extends Controller{

    public function index(){
        var_dump(dirname("http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'])."/public/uploads");
    }
    public function upload(){
        $file = request()->file("file");
        if($file){
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
            if($info){
                echo dirname("http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'])."/public/uploads/".$info->getSaveName();
            }else{
                echo $file->getError();
            }
        }
    }
}